package countBalls;

public class Solution {
    public int countBalls(int lowLimit, int highLimit) {
        int[] arr=new int[highLimit+1];
        int max=0;
        for (int i = lowLimit; i <=highLimit ; i++) {
            int box = getSum(i);
            max=Math.max(max,++arr[box]);
        }
        return max;
    }
    private int getSum(int n){
        int sum=0;
        while(n>0){
            sum+=n%10;
            n/=10;
        }
        return sum;
    }
}
